package com.sdry.web.controller.approvalManagement;

import java.io.IOException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.sdry.entity.approvalManagement.ModelEntity;
import com.sdry.service.approvalManagement.FlowManagementService;

/**
 * 
 * @ClassName: FlowManagement 
 * @Description:流程管理
 * @Author zc
 * @Date 2018年8月30日 上午10:01:52 
 * @version 1.0
 */
@Controller
@RequestMapping("flowManagement")
public class FlowManagementController {

	@Resource
	private FlowManagementService fmService;
	/**
	 * 进入流程管理页面
	 * @return
	 */
	@RequestMapping("myFlow")
	public String enterMyFlow(Model model){
		List<ModelEntity> modelList= fmService.selectModel();
		model.addAttribute("modelList",modelList);
		return "/approvalManagement/myFlow";
	}
	/**
	 * 删除表单
	 */
	@RequestMapping("deleteForm")
	public void deleteForm(HttpServletRequest request,HttpServletResponse response){
		long mId = Long.parseLong(request.getParameter("mId"));
		int isDelete = fmService.deleteForm(mId);
		try {
			response.getWriter().print(isDelete);
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
	
}
